home *** CD-ROM | disk | FTP | other *** search
- /*-----------------------------------------------------------------*/
- /* CleanUp.rexx */
- /* extract necessary information from a login file */
- /* 951225 */
- /* hansmbg@algonet.se */
- /* you can use this in two ways: */
- /* 1. handle the files in scripts, or */
- /* 2. RX >where_ever_you_want_OUTPUT CleanUp.rexx */
-
- /* define input, output and dummy files */
-
- filename = 'ram:Algonet.login'
- strippedfile = 'ram:stripped.login'
- dummyfile = 'T:earlier.logins'
-
- /* define lookup_strings, = lines to save */
-
- lookup_str_1 = 'Last login: '
- lookup_str_2 = 'Totalt utnyttjande ='
- lookup_str_3 = 'Fri tid utnyttjad = '
-
-
- /*-------- NO TRESPASSING !! ---------------*/
-
-
- /* calculate length */
- str_len_1 = length(lookup_str_1)
- str_len_2 = length(lookup_str_2)
- str_len_3 = length(lookup_str_3)
-
-
- if ~open('in',filename,READ) then do
- say ' * Error! File ''' || filename || ''' not found.'
- exit
- end
-
- /* delete earlier file */
- address command 'Delete >NIL: ' || strippedfile
-
- open('out',strippedfile,WRITE)
-
- /* lookup and save the wanted information */
- do while ~eof('in')
- instring = readln('in')
- jfr = compare(lookup_str_1,instring,)
- if jfr>str_len_1 then do
- writeln('out',instring)
- end
- jfr = compare(lookup_str_2,instring,)
- if jfr>str_len_2 then do
- writeln('out',instring)
- end
- jfr = compare(lookup_str_3,instring,)
- if jfr>str_len_3 then do
- writeln('out',instring)
- end
- end
-
- close('out')
- close('in')
-
- /* done, store it while the system runs.. */
- address command 'Type >>' || dummyfile || ' ' || filename
- address command 'Delete >NIL: ' || filename
-
- /* peek, or use for '>' file direction */
- address command 'type ' || strippedfile
-
- /*-----------------------------------------------------------------*/
- /*-----------------------------------------------------------------*/
-
-
-